﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.Paint.PaintDuringSimulation.CApPaintGun
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.Paint.PaintDuringSimulation;

public class CApPaintGun
{
  private ITx2Or3DimensionalGeometry m_brushId;
  private CApPaintGun.GunState m_paintGunState;
  private bool m_paintGunIsOpenAndBrushNotDefinedNotification;
  private string m_brushName;

  public string BrushName
  {
    get => this.m_brushName;
    set => this.m_brushName = value;
  }

  public bool PaintGunIsOpenAndBrushNotDefinedNotification
  {
    get => this.m_paintGunIsOpenAndBrushNotDefinedNotification;
    set => this.m_paintGunIsOpenAndBrushNotDefinedNotification = value;
  }

  public ITx2Or3DimensionalGeometry BrushId
  {
    get => this.m_brushId;
    set => this.m_brushId = value;
  }

  public bool PaintGunIsOpen => this.PaintGunState != 0;

  public CApPaintGun.GunState PaintGunState
  {
    get => this.m_paintGunState;
    set => this.m_paintGunState = value;
  }

  public bool ShouldPaint
  {
    get => this.PaintGunIsOpen && this.BrushId != null && ((ITxObject) this.BrushId).IsValid();
  }

  public void DisplayBrush(bool display)
  {
    if (this.BrushId == null || !((ITxObject) this.BrushId).IsValid())
      return;
    if (display)
    {
      (((ITxObject) this.BrushId).Collection as ITxDisplayableObject).Display();
      foreach (ITxObject directDescendant in (Collection<ITxObject>) ((ITxObject) this.BrushId).Collection.GetDirectDescendants((ITxTypeFilter) new TxTypeFilter(typeof (TxFrame))))
        (directDescendant as ITxDisplayableObject).Blank();
    }
    else
      (((ITxObject) this.BrushId).Collection as ITxDisplayableObject).Blank();
  }

  public void DeleteBrush()
  {
    if (this.BrushId == null)
      return;
    if (((ITxObject) this.BrushId).IsValid())
      ((ITxObject) ((ITxObject) this.BrushId).Collection).Delete();
    this.BrushId = (ITx2Or3DimensionalGeometry) null;
    this.BrushName = (string) null;
    this.PaintGunIsOpenAndBrushNotDefinedNotification = false;
  }

  public enum GunState
  {
    Close,
    Open,
    FirstNode,
  }
}
